/**
 * @file background.js
 * @author YnnSon
 * @description 后台服务脚本，处理安装事件和保持服务激活
 * @created 2025-08-07
 */
chrome.runtime.onInstalled.addListener((details) => {
  if (details.reason === 'install') {
    chrome.storage.local.clear();
  }
});

// 保持服务 worker 活跃
chrome.runtime.onStartup.addListener(() => {
  console.log('Extension started');
});

// 定时唤醒服务 worker（每分钟）
setInterval(() => {
  console.log('Service worker keep alive');
}, 60 * 1000);